package com.plugin.wxapp.rest;

import com.plugin.wxapp.entity.Plugin1;
import com.plugin.wxapp.mapper.Plugin1Mapper;
import com.plugin.wxapp.serviceImpl.TranServiec;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * description
 *
 * 小程序组件1
 * @author denglianchao
 * @version 1.0
 */
/*
@RestController
@RequestMapping("/plugin1")
@Api(description = "小程序组件1")
public class Plugin1Controller {

    @Autowired
    private Plugin1Mapper pluginMapperl;

    @Autowired
    private TranServiec testTransactional;

    @GetMapping
    public String hello(){
        return "hello, 这是集成mybatis 插件1";
    }

    @GetMapping("/list")
    @ApiOperation(value = "获取数据", notes = "获取数据", produces = "application/json")
    public List<Plugin1> getList(){
        return pluginMapperl.getList();
    }

    @GetMapping("/{id}")
    public Plugin1 getConfig(@PathVariable("id") String id){
        return pluginMapperl.getById(id);
    }

    @PostMapping("/bean")
    public List<Plugin1> getUserByIdBean(@RequestParam(value = "id", required = false) String id,
                                         @RequestParam(value = "name", required = false) String name){
        Plugin1 p = new Plugin1();
        if(!StringUtils.isEmpty(id)){
            p.setId(id);
        }
        if(!StringUtils.isEmpty(name)){
            p.setName(name);
        }
        return pluginMapperl.getByCondition(p);
    }

    @GetMapping("/transactional")
    @ApiOperation(value = "新增数据", notes = "新增数据", produces = "application/json")
    public void tran(){
        testTransactional.transactional();
    }
}
*/
